Repository navigation
feat(storage): OpenTelemetry client metrics instrument registry and views - #14398
nidhiii-27 wants to merge 17 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces OpenTelemetry client metrics support for Google Cloud Storage, allowing standard and debug metrics to be configured and recorded for both HTTP and gRPC transports. It adds configuration options to StorageOptions, GrpcStorageOptions, and HttpStorageOptions for enabling metrics, setting custom meter providers, and defining export intervals, supported by a new StorageMetricsConfig utility and StorageClientMetrics registry. Feedback on the changes suggests importing java.time.Duration to avoid using fully qualified class names throughout GrpcStorageOptions.java and OpenTelemetryBootstrappingUtils.java, which will improve code readability and consistency.
There was a problem hiding this comment.
Requesting changes mainly for the metric types/names and for accuracy of the recorded data (see inline comments).
One question on the overall design: createMeterProvider is only reached from enableGrpcMetrics(). Please state in the PR description how metrics are exported for HttpStorageOptions when metrics are enabled and no MeterProvider is supplied; both transports are expected to export through the same SDK-owned provider.
cpriti-os
left a comment
There was a problem hiding this comment.
Thanks for addressing the previous comments! Left a few small updates from our latest metrics/attributes alignment.
…nfiguration - Add configuration options to StorageOptions, GrpcStorageOptions, and HttpStorageOptions (enableOtelMetrics, enableOtelDebugMetrics, meterProvider, metricInterval). - Add development gate checking system properties and environment variables in StorageMetricsConfig. - Implement package-private instrument registry in StorageClientMetrics. - Update OpenTelemetryBootstrappingUtils to register client views with custom histogram boundaries and create client meter provider. - Add comprehensive unit tests in StorageOptionsTest, StorageClientMetricsTest, and OpenTelemetryBootstrappingUtilsTest.
Apply spotify fmt-maven-plugin formatting to StorageMetricsConfig, StorageClientMetrics, StorageOptionsTest, and StorageClientMetricsTest. [Generated-by: AI]
Use simple class name Duration instead of fully qualified java.time.Duration in GrpcStorageOptions and OpenTelemetryBootstrappingUtils. [Generated-by: AI]
…trappingUtils Apply spotify fmt-maven-plugin formatting to OpenTelemetryBootstrappingUtils. [Generated-by: AI]
…nd views [Generated-by: AI]
… metrics Refactor addClientHistogramView in OpenTelemetryBootstrappingUtils to remove unit selector and custom view description, preserving instrument default descriptions. Remove deferred Phase 2 connection metrics (dnsLookupDuration, tcpConnectDuration, tlsHandshakeDuration) from StorageClientMetrics, CLIENT_LATENCY_HISTOGRAMS, and StorageClientMetricsTest. Ensure clean Duration imports. [Generated-by: AI]
…rProvider Default api parameter to "grpc" instead of "storage" in createClientMeterProvider, allow specifying "json" / "http" transport protocols for Cloud Monitoring monitored resource storage.googleapis.com/Client, and add unit test coverage in OpenTelemetryBootstrappingUtilsTest. [Generated-by: AI]
Update createClientMeterProvider to use prefix custom.googleapis.com with default monitored resource mapping. Add KEY_URL_TEMPLATE attribute key constant in StorageClientMetrics. [Generated-by: AI]
…for default monitored resource
910b46d to
d66f432
Compare
…geClientMetricsTest [Generated-by: AI]
…m boundary helpers
Dhriti07
left a comment
There was a problem hiding this comment.
Thanks for addressing the comments ! LGTM, Holding on approval due to some failing storage tests due to unrelated issues from this PR, once the Integration test pipeline is working again and is green we can unblock this PR
This PR implements Phase 1 (Core Metrics Registry & Views) of OpenTelemetry Client Metrics in the Java Cloud Storage SDK (
google-cloud-storage).Following review feedback and architectural alignment across Storage SDKs, this PR focuses strictly on the package-private instrument registry and OpenTelemetry view/histogram bootstrapping, decoupling core infrastructure from public configuration options (handled in follow-up PR #14484).
Summary of Changes
Instrument Registry (
StorageClientMetrics):s,By,{operation},{attempt},{retry}).OpenTelemetry Views & Exporter Bootstrapping (
OpenTelemetryBootstrappingUtils):.to/).createClientMeterProviderto bootstrap Google Cloud Monitoring export undercustom.googleapis.comwith client attributes (instance_id,api).Testing:
StorageClientMetricsTest,OpenTelemetryBootstrappingUtilsTest) verifying metric registrations, custom view bucket distributions, and exporter bootstrapping usingInMemoryMetricReader.[Generated-by: AI]